<style lang="scss">
	@import "uview-ui/index.scss";
</style>

<script>
	import { getOrderAndNumber, isEmpty } from '@/utils/index.js';
	
	export default {
		onLaunch: function() {
			// 监听中间按钮的点击事件
			uni.onTabBarMidButtonTap(() => this.scanQrCode())
			
			// 检测版本是否需要升级
			this.getAppInfo();
		},
		onShow: function() {
			// console.log('App Show')
		},
		onHide: function() {
			// console.log('App Hide')
		},
		methods: {
			
			// 获取线上APP版本信息
			getAppInfo(type = 0) {
				const { appVersion, appVersionCode, platform } = uni.getSystemInfoSync();
				let params = {
					platform: platform,
					currentVersion: appVersionCode
				}
				if (params.platform != 'ios' && params.platform != 'android') false; //如果不是安卓或ios 返回false
				
				this.$http_api.checkAppVersion(params).then(res => {
					if (!res) {
						return
					}
					const { versionCode, versionNum, downloadUrl, updateDesc, isForce } = res;
					let update_info = {
						version: versionCode, //线上版本
						now_url: downloadUrl, //更新链接
						silent: 0, //是否是静默更新
						force: isForce, //是否是强制更新
						net_check: 1, //非WIfi是否提示
						note: updateDesc, //更新内容
					}
					checkUpdate(update_info, type).then(res => {
						if (res.msg) {
							plus.nativeUI.toast(res.msg);
						}
					});
				})
			},
		}
	}
</script>

<style>
	page {
		background: transparent;
	}
	
	@font-face {
	    font-family: "PINGFANG";
	    src: url('@/static/ttf/PINGFANG.TTF') format("Semibold");
	    font-style: normal;
		text-transform: none;
	}
	
	body {
		background-color: #F6FAFF;
	}
	
	.flex {
		display: flex;
		align-items: center;
	}
	
	.flex-column {
		flex-direction: column;
	}
	
	.flex-between {
		justify-content: space-between;
	}
	
	.flex-text {
		align-items: baseline;
	}
	
	.empty {
		padding: 60rpx 0;
	}
	
	.empty-placeholder {
		width: 685rpx;
		height: 100rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	
	.empty-placeholder .text {
		font-size: 26rpx;
		color: #999;
		font-family: "PINGFANG";
	}
</style>
